<template>
  <Row class="data-dictionary ">
    <Col span="24" class="col-main">
      <Form label-position="top">
        <Row v-if="!(personType === 3 && formData.isDestroy === 0)"><!--项目部 待销号 搜索不可操作-->
          <Col span="20">
            <Row>
              <Col span="5" v-if="this.personType === 1">
                <FormItem label style="margin-bottom: 14px;">
                  <Select
                    v-model="formData.enterpriseId"
                    style="width: 90%;"
                    ref="treeSelect"
                    placeholder="请选择机构"
                  >
                    <Option
                      v-for="item in list1"
                      :value="item.enterpriseId"
                      :key="item.enterpriseId"
                      style="display: none;"
                    >{{ item.title }}</Option
                    >
                    <Tree
                      :data="orgList"
                      ref="tree"
                      style="padding:0 10px"
                      @on-select-change="checkEng"
                    ></Tree>
                  </Select>
                </FormItem>
              </Col>
              <Col span="5">
                <FormItem label style="margin-bottom: 14px;">
                  <Select
                    v-model="formData.projectTeamId"
                    style="width: 90%;"
                    :clearable="proList.length>0 && personType !=3"
                    placeholder="请选择项目"
                  >
                    <Option
                      v-for="item in proList"
                      :value="item.id"
                      :key="item.id"
                    >{{ item.shortName }}</Option
                    >
                  </Select>
                </FormItem>
              </Col>
              <Col span="5">
                <FormItem
                  label
                  style="margin-bottom: 14px;"
                >
                  <Input style="width: 90%;" v-model="formData.pointName" placeholder="请输入工点名称" clearable/>
                </FormItem>
              </Col>
              <Col span="5">
                <FormItem label style="margin-bottom: 14px;">
                  <Select
                    v-model="formData.riskCategoryId"
                    style="width: 90%;"
                    clearable
                    placeholder="请选择作业风险类别">
                    <Option
                      v-for="item in list"
                      :value="item.id"
                      :key="item.id"
                    >{{ item.riskCategoryName }}</Option>
                  </Select>
                </FormItem>
              </Col>
              <Col span="5" v-if="personType === 3">
                <FormItem label style="margin-bottom: 14px;">
                  <Select
                    v-model="formData.riskLevel"
                    style="width: 90%;"
                    clearable
                    placeholder="请选择作业风险等级">
                    <Option
                      v-for="item in riskLevelList"
                      :value="item.id"
                      :key="item.id"
                    >{{ item.name }}</Option>
                  </Select>
                </FormItem>
              </Col>
              <Col span="5">
                <FormItem label style="margin-bottom: 14px;">
                  <Select
                    v-model="formData.destroyStage"
                    style="width: 90%;"
                    clearable
                    placeholder="状态">
                    <Option
                      v-for="item in statusList"
                      :value="item.id"
                      :key="item.id"
                    >{{ item.name }}</Option>
                  </Select>
                </FormItem>
              </Col>
            </Row>
          </Col>
          <Col span="4" style="text-align: right;">
            <div class="button-s">
              <Button
                type="primary"
                style="margin-right: 15px"
                @click="searchBtn"
                v-if="searchBtnShow"
              >查询</Button
              >
              <!--<Button type="warning" @click="resetBtn">重置</Button>-->
            </div>
          </Col>
        </Row>
      </Form>
      <div class="button-s">
        <Button
          type="primary"
          v-if="addBtnShow && isDispatch && personType===3"
          @click="addBtn('add', '1', '新增销号')">新增销号</Button>
        <Button type="primary" v-if="disposeBtnShow && isDispatch" @click="addBtn('dispose', '1', '销号配置')">配置</Button>
        <!--<Button type="primary" @click="deleteBtn">删除</Button>-->
      </div>
    <Tabs value=1 @on-click="tabpaneBtn" v-if="personType===3">
      <TabPane label="销号跟踪" name=1>
      </TabPane>
      <TabPane :label="label" name=0>
      </TabPane>
    </Tabs>
    <Tabs value="1" @on-click="tabpaneBtn2" v-if="personType===1 || personType===2">
      <TabPane :label="label11"  name="1"></TabPane>
      <TabPane :label="label12"  name="2"></TabPane>
      <TabPane :label="label13"  name="3"></TabPane>
      <TabPane :label="label14"  name="4"></TabPane>
    </Tabs>
      <Table
        border
        ref="selection"
        :columns="columns"
        :data="dictList"
        @on-select="selectRiado"
        @on-select-all="selectRiadoAll"
        @on-select-cancel="selectCancel"
        @on-select-all-cancel="selectAllCancel"
        @on-selection-change="selectChange"
      >
        <template slot-scope="{ row, index }" slot="action">
          <span
            title="修改进度"
            class="button-class"
            type="text"
            v-if="scheduleBtnShow && formData.isDestroy==0 && personType===3 && isDispatch"
            @click="scheduleBtn(row)"
          >修改进度</span>
          <span
            title="销号"
            class="button-class"
            type="text"
            v-if="destroyBtnShow && formData.isDestroy==0 && personType===3 && isDispatch"
            @click="destroyBtn(row)"
          >销号</span>
          <span
            title="撤销"
            class="button-class"
            type="text"
            v-if="(row.destroyStage===105 || row.destroyStage===106 ) && restBtnShow && formData.isDestroy==1 && isDispatch && personType===3"
            @click="revokeBtn(row)"
          >撤销</span>
          <span
            title="审核"
            class="button-class"
            type="text"
            v-if="(row.showButtons==1 || row.showButtons==3) && examineBtnShow "
            @click="addBtn('examine', row.id, '销号审核')"
          >审核</span>
          <span
            title="签发"
            class="button-class"
            type="text"
            v-if="row.showButtons==2 && issueBtnShow"
            @click="addBtn('issue', row.id, '销号签发')"
          >签发</span>
          <span
            title="详情"
            class="button-class"
            type="text"
            v-if="detailBtnShow"
            @click="addBtn('details', row.id, '销号详情')"
          >详情</span>
        </template>
        <template slot-scope="{ row, index }" slot="level">
          <span v-if="row.riskLevel === 1">Ⅰ级</span>
          <span v-if="row.riskLevel === 2">Ⅱ级</span>
          <span v-if="row.riskLevel === 3">Ⅲ级</span>
          <span v-if="row.riskLevel === 4">Ⅳ级</span>
        </template>
        <template slot-scope="{ row, index }" slot="destroyStage">
          <span v-if="row.destroyStage === 100">未销号</span>
          <span v-if="row.destroyStage === 101" style="color: #EE4044;">审核驳回</span>
          <span v-if="row.destroyStage === 102" style="color: #3BBB0A;">已销号</span>
          <span v-if="row.destroyStage === 103">已撤销</span>
          <span v-if="row.destroyStage === 104">发起销号</span>
          <span v-if="row.destroyStage === 105 || row.destroyStage === 106" style="color: #E7B167;">项目待审</span>
          <span v-if="row.destroyStage === 107 || row.destroyStage === 108" style="color: #E7B167;">公司待审</span>
          <span v-if="row.destroyStage === 109 || row.destroyStage === 110" style="color: #E7B167;">集团待审</span>
        </template>
      </Table>
    <Page
      class="pagination"
      :page-size-opts="[10,20,50,100]"
      :total="page.total"
      :current="page.current"
      :page-size="page.pageSize"
      @on-change="pageChange"
      @on-page-size-change="sizeChange"
      show-elevator
      show-sizer
      show-total
    />
    </Col>
    <Modal
      v-model="destroyModal"
      :mask-closable="false"
      title="销号">
      <Form  :show-message="false" :label-width="80">
        <FormItem label="销号" prop="formData.description" :required="true">
          <Input
            v-model="formData.description"
            type="textarea"
            maxlength="500"
            :autosize="{minRows: 5,maxRows: 5}"
            placeholder="请输入销号说明"></Input>
        </FormItem>
      </Form>
      <div slot="footer">
        <Button type="text" size="large" @click="destroyModal=false">取消</Button>
        <Button type="primary" size="large" @click="destroyModalSave">确定</Button>
      </div>
    </Modal>
    <Modal
      v-model="scheduleModal"
      :mask-closable="false"
      title="修改进度">
      <p style="margin-bottom: 15px;">
        当前工点开始时间为：{{scheduleData.startTime}}；
        结束时间为：{{scheduleData.endTime}}，本已经结束施工，请确认是否修改时间！
      </p>
      <Form  :show-message="false" :label-width="80">
        <FormItem label="开始时间" prop="formData.startTime" :required="true">
          <DatePicker
            type="date"
            @on-change="getStartTime"
            :value="formData.startTime"
            placeholder="开始时间"
          ></DatePicker>
        </FormItem>
        <FormItem label="结束时间" prop="formData.endTime" :required="true">
          <DatePicker
            type="date"
            @on-change="getEndTime"
            :value="formData.endTime"
            placeholder="结束时间"
          ></DatePicker>
        </FormItem>
      </Form>
      <div slot="footer">
        <Button type="text" size="large" @click="scheduleModal=false">取消</Button>
        <Button type="primary" size="large" @click="scheduleModalSave">确定</Button>
      </div>
    </Modal>
    <Modal v-model="isInquiries" title="业务问询" width="50%" ok-text="提交" :footer-hide="true">
      <div class="modal-content">
        <inquiries ref="isInquiriesBox" :checkedRows="checkedRows" :businessType="businessType" @modelBox="modelBox" @person="person"></inquiries>
      </div>
    </Modal>
    <Modal v-model="personModel" title="选择人" width="80%" ok-text="提交" :footer-hide="true">
      <div class="modal-content">
        <checkPersonNew @personBox="personBox"></checkPersonNew>
      </div>
    </Modal>
    <span class="inquiries" @click="replyChild()">问询</span>
  </Row>
</template>

<script>
import inquiries from '../../components/modules/inquiries/index'
import checkPersonNew from '../../components/modules/inquiries/checkPerson'
  export default {
    components:{
      inquiries,
      checkPersonNew
    },
    name: "risk-elimination",
    data(){
      return{
        destroyModal:false,
        scheduleModal:false,
        addBtnShow:false,
        disposeBtnShow:false,
        restBtnShow:false,
        examineBtnShow:false,
        issueBtnShow:false,
        detailBtnShow:false,
        destroyBtnShow:false,
        scheduleBtnShow:false,
        searchBtnShow:false,
        rowData:'',
        isDispatch: false,//是否为调度港
        userDetail:JSON.parse(localStorage.getItem('userList')),
        personType:JSON.parse(localStorage.getItem('personType')),
        formData:{
          name:'',
          number:0,
          isDestroy:1,
          enterpriseId:'',
          projectTeamId:'',
          pointName:'',
          riskLevel:JSON.parse(localStorage.getItem('personType')) == 3?'':'1',
          destroyStage:'',
          description:'',
          startTime:'',
          endTime:'',
        },
        scheduleData:'',
        orgList: [], //机构树
        proList: [], //项目部树
        label: (h) => {
          return h('div', [
            h('span','待销号'),
            h('Badge', {
              props: {
                count: this.formData.number
              },
              style:{
                top:'-8px'
              },
            })
          ])
        },
        label11: h => {
          return h('div', [
            h(
              'span',
              {
                style: {
                  color: '#EF3E43'
                }
              },
              'Ⅰ级风险'
            )
          ])
        },
        label12: h => {
          return h(
            'span',
            {
              style: {
                color: '#F86A30'
              }
            },
            'Ⅱ级风险'
          )
        },
        label13: h => {
          return h(
            'span',
            {
              style: {
                color: '#F3CF34'
              }
            },
            'Ⅲ级风险'
          )
        },
        label14: h => {
          return h(
            'span',
            {
              style: {
                color: '#3D6FC9'
              }
            },
            'Ⅳ级风险'
          )
        },
        dictList:[],
        list:[],
        list1:[],
        list2:[],
        projectList:[],
        treeList:[],
        riskLevelList: [
          { id: '1', name: 'Ⅰ级' },
          { id: '2', name: 'Ⅱ级' },
          { id: '3', name: 'Ⅲ级' },
          { id: '4', name: 'Ⅳ级' }
        ],
        statusList: [
          { id: '105', name: '项目待审' },
          { id: '107', name: '公司待审' },
          { id: '109', name: '集团待审' },
          { id: '101', name: '审核驳回' },
          { id: '102', name: '已销号' },
        ],
        columns:[
          {
            type: 'selection',
            width: 60,
            align: 'center'
          },
          {
            title: '序号',
            align: 'center',
            width: 70,
            render: (h, params) => {
              return h(
                'span',
                params.index + (this.page.current - 1) * this.page.pageSize + 1
              )
            }
          },
          {
            align: 'center',
            title:'公司名称',
            key:'enterpriseName',
            tooltip:true,
            /*ellipsis:true,
            render: (h, params) => {
              params.column.width=0.1;
              params.column.title='';
              if(this.personType===1){
                params.column.width=140;
                params.column.title = '公司名称';
                return h(
                  'span',
                  {
                    domProps: {
                      title: params.row.enterpriseName
                    },
                  },params.row.enterpriseName)
              }
            }*/
          },
          {
            align: 'center',
            title:'项目名称',
            key:'projectName',
            tooltip:true,
          },
          {
            title: '工点名称',
            key: 'workpointName',
            align: 'center',
            tooltip:true,
          },
          {
            title: '是否在施',
            key: 'isWork',
            align: 'center',
            width: 70
          },{
            title: '作业风险类别',
            key: 'riskCategoryName',
            align: 'center',
          },{
            title: '作业风险名称',
            key: 'riskName',
            align: 'center',
            tooltip:true,
          },{
            title: '作业风险等级',
            align: 'center',
            width:100,
            slot:'level'
          },{
            title: '状态',
            align: 'center',
            width:120,
            slot:'destroyStage'
          },
          {
            title: '操作',
            width: 200,
            align: 'center',
            slot: 'action'
          }
        ],
        deleteList:[],
        page: {
          total: 0,
          current: 1,
          pageSize: 10,
          totalPage: 0
        },
        checkedRows:[],
        businessType:'businesstype_elimination',
        isInquiries:false,
        personModel:false,
      }
    },
    methods:{
      selectChange(selection) {
        this.checkedRows = selection
      },
      // 问询弹框
      replyChild(){
        if(this.checkedRows.length > 5){
          this.$Message.warning('最多可选5条风险进行批量问询')
          return 
        }else if(this.checkedRows.length == 0){
            this.$Message.warning('请先选择需要问询的风险')
            return
        }else{
            let isM = true,self = this
            try{
                self.checkedRows.forEach((e,index)=>{
                    if(index>0){
                        if(e.projectId != self.checkedRows[index-1].projectId){
                            this.$Message.warning('仅能选择同一项目下的风险询问')
                            isM = false
                            throw Error()
                        }
                    }
                })
            }catch(e){}
            if(isM){
                this.isInquiries = true
                this.$refs.isInquiriesBox.isModel()
            }
        }
      },
      // 关闭问询框
      modelBox(){
        this.isInquiries = false
      },
      // 打开人员选择框
      person(){
        this.personModel = true
      },
      // 关闭人员选择框
      personBox(){
        this.personModel = false
      },
      //查询当前用户是否为调度员
      checkPerson(){
        this.$api.measurePlan.checkDispatch().then(res => {
          if(res.code === 200){
            this.isDispatch = true;
          } else {
            this.isDispatch = false;
          }
        })
      },
      //风险类别
      getRiskCategoryFindAll() {
        this.$api.measuresLibrary.getRiskCategoryFindAll().then(res => {
          if (res.code == 200) {
            this.list = res.data
          } else {
            this.$Message.error(res.message)
          }
        })
      },
      //列表
      getWbsTabelList(){
        let param ={
          currentPage: this.page.current,
          pageSize: this.page.pageSize,
          whereMap: {
            "isDestroy": this.formData.isDestroy,//"是否销号 0未销号    1已销号",
            "projectId": this.formData.projectTeamId,//"项目id",
            "enterpriseId": this.formData.enterpriseId,//"机构id",
            "pointName": this.formData.pointName,//"工点名称",
            "riskLevel": this.formData.riskLevel,//"作业风险等级(0:全部，1：1级，2：2级，3：3级，4：4级)",
            "destroyStage": this.formData.destroyStage,//"销号状态",
            "riskCategoryId": this.formData.riskCategoryId,//"风险类别id",
            "isWork":null,
            riskName:'',
          }
        };
        this.$api.riskElimination.getRiskOrderDestroyList(param).then(res => {
          if(res.code === 200){
            this.dictList = res.data.resultObject;
            this.page.total = res.data.totalRecord;
            this.page.totalPage = res.data.totalPage
          }else {
            this.$Message.warning(res.message)
          }
        })
      },
      //总数数量
      getRiskOrderDestroycountNoDestroy(){
        this.$api.riskElimination.getRiskOrderDestroycountNoDestroy().then(res => {
          if(res.code === 200){
            this.formData.number = res.data==''?0:res.data;
          }else {
            this.$Message.warning(res.message)
          }
        })
      },
      //总数数量--has
      getRiskOrderDestroyhasRead(){
        this.$api.riskElimination.getRiskOrderDestroyhasRead().then(res => {
          if(res.code === 200){
            this.formData.number = res.data==''?0:res.data;
          }else {
            this.$Message.warning(res.message)
          }
        })
      },
      //机构树
      getOrgTree() {
        this.orgList = [];
        this.list1 = [];
        this.$api.measurePlan.getOrgTree().then((res) => {
          if (res.code == 200) {
            this.orgList = res.data
            const tree = this.$refs.tree
            this.$nextTick(() =>  tree.handleSelect(tree.data[0].nodeKey))
          } else {
            this.$Message.error(res.data.msg);
          }
        })
      },
      checkEng(data) {//点击机构树
        if (data.length > 0) {
          this.formData.projectTeamId = '';
          this.list1 = []
          let title = data[0].title
          if(data[0].objectId){
            let enterpriseId = data[0].objectId
            this.list1.push({
              title,
              enterpriseId
            })
            this.getProTree(data[0]);
            this.formData.enterpriseId = enterpriseId
            this.$refs.treeSelect.visible = false
          }else {
            this.$Message.warning('请选择'+title+'下的子集')
          }
        }
      },
      //获取项目树
      getProTree(data) {
        this.proList = [];
        this.$api.measurePlan.getProList(data.objectId).then(res => {
          if (res.code === 200) {
            if(res.data.length>0){
              this.proList = res.data;
              if(this.personType == 3){
                this.formData.projectTeamId = this.proList[0].id;
              }else if(this.personType == 2){
                this.formData.enterpriseId = data.objectId;
              }else{
                this.formData.projectTeamId = '';
              }
              this.getWbsTabelList();
            }
          } else {
            this.$Message.error(res.message)
          }
        })
      },
      /*checkPro(data) {//点击项目树
        if (data.length > 0) {
          this.list2 = []
          let proId = data[0].id
          let title = data[0].name
          this.list2.push({
            proId,
            title
          })
          this.formData.projectTeamId = proId
          this.$refs.treeSelectPro.visible = false
        }
      },*/
      destroyBtn(row){//销号
        this.destroyModal = true;
        this.rowData = row;
        this.formData.description = '';
      },
      getRiskOrderDestroydestroyCreate(type){
        let params = {
          "description": this.formData.description,//描述 ,
          "id": this.rowData.id,//风险id
          "orgType": this.personType,//机构层级， 1集团 2工程公司 3项目部 ,
          "type": type,//销号操作类型（1:新增，2:撤销，3:审核，4:签发, 5驳回）
        }
        this.$api.riskElimination.getRiskOrderDestroydestroyCreate(params).then(res => {
          if(res.code === 200){
            this.destroyModal = false;
            this.$Message.success(res.message);
            this.getWbsTabelList();
            if(type === 1)
            this.destroyModal = false;
          }else {
            this.$Message.warning(res.message)
          }
        })
      },
      getRiskOrderDestroydestroyCancel(type){
        let params = {
          "description": this.formData.description,//描述 ,
          "id": this.rowData.id,//风险id
          "orgType": this.personType,//机构层级， 1集团 2工程公司 3项目部 ,
          "type": type,//销号操作类型（1:新增，2:撤销，3:审核，4:签发, 5驳回）
        }
        this.$api.riskElimination.getRiskOrderDestroydestroyCancel(params).then(res => {
          if(res.code === 200){
            this.destroyModal = false;
            this.$Message.success(res.message);
            this.getWbsTabelList();
            if(type === 1)
              this.destroyModal = false;
          }else {
            this.$Message.warning(res.message)
          }
        })
      },
      destroyModalSave(){
        if(!this.formData.description){
          this.$Message.warning("说明不能为空");
          return;
        }
        this.getRiskOrderDestroydestroyCreate(1)
      },
      revokeBtn(row){//撤销
        this.$Modal.confirm({
          title: '温馨提示',
          closable: true,
          content: '确认要撤销吗？',
          width: 360,
          onOk: () => {
            this.rowData = row;
            this.formData.description = '';
            this.getRiskOrderDestroydestroyCancel(2)
          }
        })
      },
      getStartTime(starTime) {
        this.formData.startTime = starTime
      },
      getEndTime(endTime) {
        this.formData.endTime = endTime
      },
      scheduleBtn(row){//修改进度
        this.scheduleModal =true;
        this.formData.startTime = '';
        this.formData.endTime = '';
        this.scheduleData = row;
      },
      scheduleModalSave(){
        let params = {
          workpointId:this.scheduleData.constructionPointId,
          startTime:this.formData.startTime,
          endTime:this.formData.endTime,
        }
        this.$api.riskElimination.getRiskOrderDestroyupdateProgress(params).then(res => {
          if(res.code === 200){
            this.$Message.success(res.message);
            this.scheduleModal = false;
            this.getWbsTabelList();
          }else {
            this.$Message.warning(res.message)
          }
        })
      },
      addBtn(type, id, name) {
        if (type === 'add') {
          this.$router.push({
            path: `risk-elimination/${type}/${id}/${name}`,
          })
        } else if(type === 'dispose'){
          this.$router.push({
            name:'risk-elimination-dispose',
            params:{type,id,name}
          })
        }else {
          if(this.formData.isDestroy === '0'){
            this.$router.push({
              path: `risk-elimination-detail/${type}/${id}/${'辨识详情'}`,
              query:{isDestroy:0}
            })
          }else {
            if(type === 'examine'){
              this.$router.push({
                name: 'risk-elimination-examine',
                params:{type,id,name}
              })
            }else if(type === 'issue'){
              this.$router.push({
                name: 'risk-elimination-issue',
                params:{type,id,name}
              })
            }else if(type === 'details'){
              this.$router.push({
                path: `risk-elimination-detail/${type}/${id}/${name}`,
              })
            }
          }

        }
      },

      tabpaneBtn(e){//tab切换
        this.page.current =1;
        this.page.currentPage =10;
        this.formData.isDestroy = e;
        this.getWbsTabelList();
        if(e =='0'){
          this.getRiskOrderDestroyhasRead();
        }
      },
      tabpaneBtn2(e){//tab切换--集团/公司
        this.page.current =1;
        this.page.currentPage =10;
        this.formData.riskLevel = e;
        this.getWbsTabelList();
      },
      //按钮显示
      buttonShow() {
        let buttonList = JSON.parse(localStorage.getItem('buttonList'))
        buttonList.map(val => {
          let key = Object.keys(val).toString();
          if (key === this.$route.name) {
            Object.values(val)[0].map(item => {
              if (item.code === 'P_0901_01') {
                this.addBtnShow = true
              } else if (item.code === 'P_0901_02') {
                this.disposeBtnShow = true
              } else if (item.code === 'P_0901_04') {
                this.restBtnShow = true
              }else if (item.code === 'P_0901_05') {
                this.examineBtnShow = true
              }else if (item.code === 'P_0901_06') {
                this.issueBtnShow = true
              }else if (item.code === 'P_0901_07') {
                this.detailBtnShow = true
              }else if (item.code === 'P_0901_08') {
                this.destroyBtnShow = true
              }else if (item.code === 'P_0901_09') {
                this.scheduleBtnShow = true
              }else if (item.code === 'P_0901_03') {
                this.searchBtnShow = true
              }
            })
          }
        })
      },
      //搜索
      searchBtn() {
        this.page.current = 1
        this.getWbsTabelList()
      },
      //重置
      resetBtn() {
        this.formData.projectTeamId = '';
        this.formData.pointName = '';
        this.formData.riskLevel = '';
        this.formData.destroyStage = '';
        this.formData.riskCategoryId = '';
        this.getWbsTabelList()
      },
      //全选
      selectRiadoAll(e) {
        this.deleteList = e
      },
      //全选取消
      selectAllCancel() {
        this.deleteList = []
      },
      //单选
      selectRiado(e) {
        this.deleteList = e
      },
      //取消某一项
      selectCancel(e) {
        this.deleteList.splice(e, 1)
      },
      pageChange(current) {
        this.page.current = current
        this.getWbsTabelList(this.parentId)
      },
      sizeChange(size) {
        this.page.current = 1
        this.page.pageSize = size
        this.getWbsTabelList(this.parentId)
      }
    },
    mounted() {
      this.checkPerson();
      this.getRiskCategoryFindAll();
      this.getRiskOrderDestroycountNoDestroy();
      this.buttonShow();
      //1集团 2工程公司 3项目部
      if (this.personType === 3) {
        this.columns.splice(1,2);
        this.getProTree({objectId:this.userDetail.projectTeamId})
      }else if(this.personType === 1){
        this.getOrgTree();
      }else if(this.personType === 2){
        this.columns.splice(1,1)
        this.getProTree({objectId:this.userDetail.enterpriseId})
      }
    },
    activated() {
      this.page.current = 1;
      if(this.personType === 3){
        this.formData.projectTeamId = this.userDetail.projectId
      }else if(this.personType === 2){
        this.formData.enterpriseId = this.userDetail.enterpriseId
      }
      this.getWbsTabelList();
      this.getRiskOrderDestroycountNoDestroy();
    }
  };
</script>

<style lang="scss" scoped>
  .data-dictionary {
    height: calc(100% - 0px);
    .col-height100 {
      height: 100%;
      border-right: 1px solid #ebeef1;
      overflow: auto;
      p {
        padding: 10px;
      }
    }
    .col-main {
      padding: 10px;
      .button-s {
        margin-bottom: 15px;
        button {
          margin-right: 15px;
        }
      }
    }
    .tabs_box {
      color: #f00 !important;
    }
  }
</style>
